function a(a, t, e) {
  return t in a ? Object.defineProperty(a, t, {
      value: e,
      enumerable: !0,
      configurable: !0,
      writable: !0
  }) : a[t] = e, a;
}

var t = require("../../../utils/function.js"), e = require("../../../config.js"), i = getApp(), n = require("../../../api.js");

Page({
  data: {
      prace:'',
      imgs: t.userImg,
      img: t.driverImg,
      TodayIncome: 0,
      Spending: 0,
      Income: 0,
      Refund: 0,
      balance: 0,
      actions: e.extract,
      cancelText: "取消",
      page: 1,
      list: [],
      pageSize: 20,
      start_time: "",
      hasMoreData: !0,
      distribution: 1
  },
  intoPageHandler: function(a) {
      t.intoPageHandler(a.currentTarget.dataset.skip), this.setData({
          page: 1
      });
  },
  onLoad: function(a) {
      a.uid && i.shareCouponsMessage(a.uid);
      var p = a.prace
      this.setData({
        prace:p
      })
  },
  onReady: function() {},
  onShow: function() {
      this.get_info_list();
  },
  onReachBottom: function(a) {
      this.data.hasMoreData ? this.get_info_list() : wx.showToast({
          title: "没有更多数据",
          duration: 1e3,
          icon: "none"
      });
  },
  toDetail: function(a) {
      var t = a.currentTarget.dataset.id;
      wx.navigateTo({
          url: "/pages/driver/walletDetail/walletDetail?id=" + t
      });
  },
  get_info_list: function() {
      var t = this;
      i.request({
          url: n.wallet_log.index,
          method: "post",
          data: {
              page: t.data.page,
              start_time: t.data.start_time
          },
          success: function(e) {
              var i = t.data.list;
              if (1 == e.code) {
                  var n;
                  t.setData((n = {
                      TodayIncome: e.data.user.TodayIncome
                  }, a(n, "TodayIncome", e.data.user.TodayIncome), a(n, "Spending", e.data.conclusion.Spending), 
                  a(n, "Income", e.data.conclusion.Income), a(n, "Refund", e.data.conclusion.Refund), 
                  a(n, "balance", e.data.user.price), n)), 1 == t.data.page && (i = []);
                  var s = e.data.wallet.data;
                  s.length < t.data.pageSize ? t.setData({
                      list: i.concat(s),
                      hasMoreData: !1
                  }) : t.setData({
                      list: i.concat(s),
                      page: t.data.page + 1,
                      hasMoreData: !0
                  });
              } else wx.showToast({
                  title: "暂无数据",
                  duration: 1e3
              });
          }
      });
  },
  openActionsheet: function() {
      this.setData({
          show: !0
      });
  },
  closeActionSheet: function() {
      this.setData({
          show: !1
      });
  },
  clickAction: function(t) {
      var e, i = this, n = t.detail, s = this;
      s.setData({
          page: 1
      });
      var o = n.index;
      switch (this.setData((e = {}, a(e, "actions[" + o + "].loading", !0), a(e, "actionType", o), 
      e)), o) {
        case 0:
          wx.navigateTo({
              url: "/pages/driver/withdraw-money/index?type=1&&yue=" + s.data.balance + "&&distribution=" + s.data.distribution
          });
          break;

        case 1:
          wx.navigateTo({
              url: "/pages/driver/withdraw-ali/index?type=2&&yue=" + s.data.balance + "&&distribution=" + s.data.distribution
          });
          break;

        case 2:
          wx.navigateTo({
              url: "/pages/driver/withdraw-wechat/index?type=0&&yue=" + s.data.balance + "&&distribution=" + s.data.distribution
          });
      }
      setTimeout(function() {
          var t;
          i.setData((t = {}, a(t, "show", !1), a(t, "actions[" + o + "].loading", !1), t));
      }, 100);
  },
  bindTimeChange: function(a) {
      var t = this;
      t.setData({
          page: 1,
          start_time: a.detail.value
      }), t.get_info_list();
  },
  onShareAppMessage: function() {
      return {
          title: i.shareAppMessage().title,
          imageUrl: i.shareAppMessage().imageUrl,
          desc: i.shareAppMessage().desc,
          path: i.shareAppMessage().path
      };
  },
  onbalance:function(e){
      console.log(e);
  var p =   e.currentTarget.dataset.url 
 var t =  e.currentTarget.dataset.prace
 console.log(t);
      wx.navigateTo({
        url: p +'?prace=' + t
   
      })
  }
});